package com.activemq.producer.impl;

import com.activemq.producer.IMessageProducerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;

import javax.jms.Queue;
import javax.jms.Topic;

/**
 * @Author: 胡成
 * @Version: 0.0.1V
 * @Date: 2018/10/24
 * @Description: 推送给所有订阅的topic
 **/
@Service("messageProducerTopicService")
public class MessageProducerTopicServiceImpl implements IMessageProducerService{

    @Autowired
    private JmsMessagingTemplate messagingTemplate;

    @Override
    public void sendMessageQueue(String msg, Queue queue) {

    }

    @Override
    public void sendMessage(String msg,Topic topic) {
        messagingTemplate.convertAndSend(topic,msg);
    }
}
